package com.learn.error;

import org.springframework.boot.web.server.ErrorPage;
import org.springframework.boot.web.server.ErrorPageRegistrar;
import org.springframework.boot.web.server.ErrorPageRegistry;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;

//@Component
public class CommonErrorPageRegistrar implements ErrorPageRegistrar {

	@Override
	public void registerErrorPages(ErrorPageRegistry registry) {
		ErrorPage e404 = new ErrorPage(HttpStatus.NOT_FOUND,"/error/e404.html");
		ErrorPage e505 = new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR,"/error/e500.html");
		
		registry.addErrorPages(e404,e505);
		
	}
}
